import { defineStore } from "pinia";

export const useMainStore = defineStore('main', {
    state: () => ({
        svgStack: [] as any,
        chosenEntityType: null as (string | any),
        chosenBlock: null as any,
    }),
    actions: {
        addElementToStack() {
            this.svgStack.push([]);
        },

        choseBlock(block: any[]) {
            this.chosenEntityType = 'block';
            this.chosenBlock = block;
        },

        addChartToBlock(block: any[]) {
            const chart = { 
                id: null,
                type: 'chart',
                width: 100, 
                height: 100,
                margin: { top: 10, left: 10, right: 10, bottom: 10 },
                chartElements: [],
                dataSourceConfig: {},
            }

            console.log(1)

            block.push(chart);
        }
    }
})